package com.erp.activity;

import android.app.Activity;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Log;

import com.erp.mclass.UnCeHandler;
import com.erp.Myapp;
import com.erp.util.Sputil;


/**
 * Created by Administrator on 2016/12/31/031.
 * 作者：刘洋
 */
public abstract class BasedialogActivity extends Activity {
    public String activityname="";
    SharedPreferences.Editor editor;//sp储存器
    SharedPreferences sp;//sp提取器
    Myapp application;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(getLayoutId());
        application = (Myapp) getApplication();
//        application.init();
        application.addActivity(this);
        editor = Sputil.editor("erp");
        sp = Sputil.sp("erp");
        initCreate();
    }
    //加载页面布局文件
    protected abstract int getLayoutId();
    //oncreate
    protected abstract void initCreate();

    @Override
    protected void onDestroy() {
        super.onDestroy();
        application.removeActivity(this);
    }
    @Override
    protected void onResume() {
        super.onResume();
        Log.d("TAAAG","activity="+activityname);
        UnCeHandler.activity=activityname;
    }
}
